﻿using BLL;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Com.Qkds.Erp.WebUi
{
    public partial class EditPwd : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            UsersModel model = new UsersModel()
            {
                Name = Session["Users"].ToString(),
                 Pwd=this.txtNewPwd.Text
            };
            if (new UsersBLL().Edit(model))
            {
                Response.Write("<script>alert('修改成功，请重新登入！')</srcipt>");
                Response.Redirect("Login.aspx");
            }
            else
            {
                Response.Write("<script>alert('修改失败！')</srcipt>");
            }

            
            if (txtNewPwd.Text==""||txtOKNewPwd.Text=="")
            {
                Response.Write("新密码不能为空！");
                return; 
            }
            if (txtNewPwd.Text!=txtOKNewPwd.Text)
            {
                Response.Write("两次输入的密码不正确，请重新输入！");
                return;
            }

        }

        protected void lbtnReturn_Click(object sender, EventArgs e)
        {
            Response.Redirect("Home.aspx");
        }
    }
}